package com.atcc.test.mapper;

import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Options.FlushCachePolicy;

import com.atcc.test.domain.StudentInfo;
import com.atcc.test.domain.User;

@Mapper
public interface UserMapper {
      
	@Select("select * from students where name = #{name}")
	@Results({
		@Result(property="name",column="name"),
		@Result(property="classname",column="classname"),
		@Result(property="age",column="age"),
		@Result(property="duty",column="zhiwu"),
		@Result(property="description",column="description"),
		@Result(property="collegeInfo",column="name",
		many=@Many(select = "com.atcc.test.mapper.CollegeMapper.selectColInfoByName"))
	})
	@Options(useCache=true,flushCache=FlushCachePolicy.FALSE)
	StudentInfo selectStuInfoByName(String name);  

	@Select("select * from users where username = #{userName}")
	@Results({
		@Result(column="userName",property="userName"),
		@Result(column="id",property="id"),
		@Result(column="password",property="password"),
		@Result(column="roles",property="roles")
	})
	@Options(useCache=true,flushCache=FlushCachePolicy.FALSE)
	User findByUserName(String userName);
	
	
}
